
package com.lk.lkappearance.controller;

import com.lk.lkappearance.common.AbstractBaseController;
import com.lk.lkappearance.model.Role;
import com.lk.lkappearance.service.RoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
@RequestMapping("/api/role")
public class RoleController extends AbstractBaseController {


    @Autowired
    RoleService roleService;
    @PostMapping("/list")
    @ResponseBody
    public Map<String,Object> list(@RequestBody Role role) {
        return roleService.getList(role);
    }
    @PutMapping("/modify/{roleId}")
    @ResponseBody
    public Map<String,Object> modify(@PathVariable("roleId") String roleId,@RequestBody Role role) {
        return roleService.modify(role);
    }

    @PostMapping("/add")
    @ResponseBody
    public Map<String,Object> add(@RequestBody Role role) {
        return roleService.add(role);
    }

    @PutMapping("/delete/{id}")
    @ResponseBody
    public Map<String,Object> delete(@PathVariable("id") String roleId) {
        return roleService.delete(roleId);
    }



}
